import { httpJ} from '../conf/index-json'
import { baseURL} from '../conf/index'
// 查询左侧结构树
export const getTreeList = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/unit_info/tree`, (params)).then(res => res.data)
}

// 查询下级单位
export const getSubUnit = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/unit_info/page/sub`, (params)).then(res => res.data)
}
// 创建下级单们
export const addUnit = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/unit_info/save`, (params)).then(res => res.data)
}
// 获取级别树
export const getLevelTree =(params = {}) => {
  return httpJ.get(`${baseURL}/api/organ/unit_level/tree`, (params)).then(res => res.data)
}
//获取所有的伙食单位-当前用户子级 
export const getSubCanteenList=(params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/unit_info/page/kitchen`, (params)).then(res => res.data)
}
export const editUnit = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/unit_info/modify`,(params)).then(res => res.data)
}
export const deleteUnit = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/unit_info/delete`,(params)).then(res => res.data)
}

export const resetPassword = (params = {}) => {
  return httpJ.post(`${baseURL}/api/auth/auth_user/reset_password`,(params)).then(res => res.data)
}

export const getUnitEchartData = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/out_in_stock/statistic/unit`,(params)).then(res => res.data)
}

export const getRationEchartData = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/out_in_stock/statistic/rationClass`,(params)).then(res => res.data)
}
export const getAuditLog = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/index/audit/record`,(params)).then(res => res.data)
}

export const getLogTypeList = (params = {}) => {
  return httpJ.post(`${baseURL}/api/organ/audit_log/type`,(params)).then(res => res.data)
}

export const getStatisList = (params = {}) => {
  return httpJ.get(`${baseURL}/api/organ/ration_class/statistics/list`,(params)).then(res => res.data)
}
//  获取单位所有配置
export const getSystemConfigList = (params = {}) => {
  return httpJ.get(`${baseURL}/api/auth/system_config/list`,{params}).then(res => res.data)
}
// 修改单位配置
export const editSystemConfigList = (params = {}) => {
  return httpJ.post(`${baseURL}/api/auth/system_config/edit_list`,(params)).then(res => res.data)
}

